﻿using System;
using System.Web.Services;
using FranceTriple.Dal;
using TeamFranceTriple.Config;

namespace TeamFranceTriple
{
    public partial class LastUserVisit : BaseUserControl
    {
        private static Int32 MaxUser = TeamFranceTripleConfig.WebConfig.LastUserVisit.MaxNumberOfUser;
        private static Int32 AutoRefreshFrequency = TeamFranceTripleConfig.WebConfig.LastUserVisit.AutoRefresh;

        protected void Page_Load(object sender, EventArgs e)
        {
            if (AutoRefreshFrequency == 0)
                LastUserVisitTimer1.Enabled = false;
            else if (!Request.Browser.IsMobileDevice && ThisMaster.Requester.IsAuthenticated)
                LastUserVisitTimer1.Interval = AutoRefreshFrequency * 1000;

            BulletedList1.DataSource = new UserProfile().GetLastUserVisit(MaxUser);
            BulletedList1.DataBind();
        }

        [WebMethod]
        private static string[] GetLastUserVisit(DateTime LastVisiteur)
        {
            return new UserProfile().GetLastUserVisit(MaxUser);
        }
    }
}
